package com.ruoyi.flowable.common.enums;

import java.util.Arrays;

/**
 * 流程意见类型
 *
 * @author Tony
 * @date 2021/4/19
 */
public enum FlowComment {

    /**
     * 提交申请
     */
    SUBMIT("0", "提交申请","success"),

    /**
     * 审批意见
     */
    NORMAL("1", "审批意见","success"),

    /**
     * 退回意见
     */
    REBACK("2", "退回意见","danger"),

    /**
     * 驳回意见
     */
    REJECT("3", "驳回意见","warning"),

    /**
     * 委派意见
     */
    DELEGATE("4", "委派意见","primary"),

    /**
     * 转办意见
     */
    TRANSFER("5", "转办意见","primary"),

    /**
     * 终止流程
     */
    STOP("6", "终止流程","danger"),

    /**
     * 取消申请
     */
    CANCEL("7", "取消申请","danger"),

    /**
     * 取回重办
     */
    REVOKE("8", "撤回重办","danger");

    /**
     * 类型
     */
    private final String type;

    /**
     * 说明
     */
    private final String remark;

    /**
     * 样式
     */
    private final String style;

    public static String getRemarkByType(String type){
        return Arrays.stream(FlowComment.values())
                .filter(s -> s.getType().equals(type))
                .map(FlowComment::getRemark)
                .findFirst().orElse("未知");
    }

    public static FlowComment getFlowCommentByType(String type){
        return Arrays.stream(FlowComment.values())
                .filter(s -> s.getType().equals(type)).findFirst()
                .orElse(FlowComment.NORMAL);
    }

    FlowComment(String type, String remark, String style) {
        this.type = type;
        this.remark = remark;
        this.style = style;
    }

    public String getType() {
        return type;
    }

    public String getRemark() {
        return remark;
    }

    public String getStyle() {
        return style;
    }
}
